//
//  RSDBQuery.h
//  WWRU
//
//  Created by Johnnie Walker on 09/04/2009.
//  Copyright 2009 Random Sequence. All rights reserved.
//

#import <Foundation/Foundation.h>

@class RSDBTable, RSDBRecord;
@interface RSDBQuery : NSObject {
	RSDBTable *table;
	NSArray *columns;
	NSArray *conditions;
	NSArray *parameters;
	NSArray *orderby;	
	
	int offset;
	int limit;	
}

@property int limit;
@property int offset;
@property (nonatomic, retain) NSArray *columns;
@property (nonatomic, retain) NSArray *parameters;
@property (nonatomic, retain) NSArray *conditions;
@property (nonatomic, retain) NSArray *orderby;
@property (nonatomic, retain) RSDBTable *table;

- (RSDBQuery *)addColumn:(id)columnName;
- (RSDBQuery *)addParameter:(id)parameter;
- (RSDBQuery *)addCondition:(NSString *)condition;
- (RSDBQuery *)addCondition:(NSString *)condition parameter:(id)parameter;
- (RSDBQuery *)addOrderby:(NSString *)columnName;
- (RSDBQuery *)addOrderby:(NSString *)columnName ascending:(BOOL)ascending;

- (NSArray *)execute;
- (RSDBRecord *)findOne;

@end





